{%load static %}
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>file</title>
    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <!-- JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
        crossorigin="anonymous"></script>
    <link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet">
    <style>
        .card a {
            text-decoration: none;
            color: #198754;
        }

        .card {
            margin: 2px;
        }

        .card:hover {
            background-color: #198754;
            transition: .3s;
            color: aliceblue;
        }

        .card:hover a {
            color: aliceblue;
            transition: .3s;
        }

        .url{
            font-weight: bold;
        }
    </style>
</head>

<body>
    <div class="container">
        <nav class="my-4">
            <a href="../" class="btn btn-success">返回上一级目录</a>
            {%for p in path_arr%}<span>/</span><span class="url mx-2">{{p}}</span>{%endfor%}
        </nav>
        {% if not files%}
        <div class="card">
            <div class="card-body">
                没有文件
            </div>
        </div>
        {%endif%}
        {% for file in files%}
        <div class="card">
            <div class="card-body">
                {%if file.1 and request.path == '/' %}
                <i class="ri-folder-line"></i><a href="{{file.0}}/" class="dir">{{file.0}}</a>
                {%elif file.1 %}
                <i class="ri-folder-line"></i> <a href="/{{path_url}}{{file.0}}/" class="dir">{{file.0}}</a>
                {%else%}
                <a download="{{file.0}}" class="file"
                    href="{% get_media_prefix %}{{path_url}}{{file.0}}">{{file.0}}</a>
                {%endif%}
            </div>
        </div>
        {%endfor %}
    </div>
</body>

</html>